import { User } from 'src/user/user.entity';
import { Column, Entity, PrimaryGeneratedColumn, ManyToOne, JoinColumn, JoinTable } from 'typeorm';

@Entity('follow')
export class Follow {
  /**
   * 自增主键
   */
  @PrimaryGeneratedColumn({
    comment: '自增ID'
  })
  id: number;

  @Column({
    comment: '粉丝id'
  })
  fans_user_id: number;

  @Column({
    comment: '被关注人id'
  })
  follow_user_id: number;

  @Column({
    comment: '创建时间'
  })
  create_time: number;

  @Column({
    comment: '更新时间'
  })
  update_time: number;

  @Column({
    comment: '删除时间'
  })
  delete_time: number;

  @ManyToOne((type) => User, (user) => user.follow)
  @JoinColumn({ name: 'follow_user_id' })
  fans_user: User;

  @ManyToOne((type) => User, (user) => user.fans)
  @JoinColumn({ name: 'fans_user_id' })
  follow_user: User;
}